TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../../../config.mk

# Inputs
SRC_DATA := $(TASK_DIR)/src/get_shoot_hom_by_CA.R
CLASSIFIED_VICTIMS := $(BUILD_DATA_PIPELINE)/classify_victimizations/output/classified_victimizations.feather
SHOOTING_VICS := $(BUILD_DATA_PIPELINE)/load_cpd_data/output/cpd_shooting_victims.feather
HOMICIDE_VICS := $(BUILD_DATA_PIPELINE)/load_cpd_data/output/cpd_homicide_victims.feather
GEOCODES := /projects/data/geocodes/chicago_geocodes.csv
CONFIG_FILE := $(TASK_DIR)/../hand/config.yaml

# Output
SHOOT_AND_HOM_VICS_BY_MONTH_AND_CA := $(OUT_DIR)/shooting_and_homicide_vics_by_month_and_ca.csv

$(SHOOT_AND_HOM_VICS_BY_MONTH_AND_CA): $(SRC_DATA) $(CONFIG_FILE) $(CLASSIFIED_VICTIMS) $(SHOOTING_VICS) $(HOMICIDE_VICS) $(GEOCODES)
	@mkdir -p $(OUT_DIR)
	@$(R_script) $(SRC_DATA) \
		--CONFIG_FILE=$(CONFIG_FILE) \
		--CLASSIFIED_VICTIMS=$(CLASSIFIED_VICTIMS) \
		--SHOOTING_VICS=$(SHOOTING_VICS) \
		--HOMICIDE_VICS=$(HOMICIDE_VICS) \
		--GEOCODES=$(GEOCODES) \
		--COMMUNITY_AREA_SHAPEFILE=$(COMMUNITY_AREA_SHAPEFILE) \
		--OUT_DIR=$(OUT_DIR) \
		--SHOOT_AND_HOM_VICS_BY_MONTH_AND_CA=$(SHOOT_AND_HOM_VICS_BY_MONTH_AND_CA)

.PHONY: all clean
.DEFAULT_GOAL=all

all: $(SHOOT_AND_HOM_VICS_BY_MONTH_AND_CA)

clean:
	rm -rf $(OUT_DIR)
